package com.cloud.lock.web;


import com.cloud.lock.id.RedisIdFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.net.spi.nameservice.NameService;

@RestController
@RequestMapping("/id")
public class IDGenernateController {



    @Autowired
    private RedisIdFactory redisIdFactory;

    @RequestMapping("/genernate")
    public Long generate() {
        Long id = redisIdFactory.generate("user");
        return id;
    }

    @RequestMapping("/genHash")
    public Long genernateHash() {
        return redisIdFactory.genernateWithHash("article", "news", 10L);
    }
}
